package com.yzr.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @description
 * @author: yx-0173
 * @date: 2021-08-24 17:12
 **/
public class Servlet2 extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("servlet2接收参数 ：" + req.getParameter("username"));

        // 获取上下文
        Object key = req.getAttribute("key");
        System.out.println("servlet2获取上下文：" + key);

    }
}
